<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>报备记录</title>
<meta name="viewport" content="width=100%, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/lib/weix/style/weui.min.css">
<link rel="stylesheet" href="/css/fonts.css">
<link rel="stylesheet" href="/css/comm.css">
<link rel="stylesheet" href="/css/list_hej.css">
</head>

<body>
<!--<div class="th-heads__boxs">
	<div class="th-heads__box th-xx_bot">
        <a class="th-heads__itme" href="javascript:;" id="J_date_ans"><i class="icon-date"></i><span>日期查找</span></a>
        <a class="th-heads__itme th-xx_left" href="javascript:;"><i class="weui-icon-search"></i><span>搜索</span></a>
    </div>
</div>-->

<div id="J_list">

</div>

<div class="weui-loadmore" id="J_loadmore">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加载</span>
</div>


<script src="/js/zepto.min.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script src="/js/comm.js"></script>
<script type="text/javascript">
$(function(){
	function getCustomerList(page,rows){
		var uid = "${uid}";
		var isall = "${isall}";
		var data = {page:page,rows:1000,uid:uid,returnType:1,isall:isall};
		var url = "/customer/customer_list";
		$.ajax({
			type: "POST",
			dataType: 'json',
			async: false,
			contentType: "application/json; charset=utf-8",
			data: JSON.stringify(data),
			url: url,
			success: function(res){
				if(res.code == 200){
					//操作
					var list = res.data.list;
					//console.log(list);
					for(var i in list) {
						
						var shtml = '<div class="th-date__boxs"><div class="th-date__box J_date_box"><span class="tit max">'+i+'</span><span class="more max"></span></div></div>'+
										'<div class="weui-cells lib top_no">'
						var lists =  list[i];
						for (var j =0;j<lists.length;j++){
														
									var zhant_data = lists[j]['status'];
									
									shtml += '<div class="weui-cell weui-cell_access">'+
												'<a class="weui-cell__hd tb" style="color:#f52e00" href="/customerPage/customerDetail/'+lists[j]['id']+'"><i class="icon-user "></i></a>'+
												'<a class="weui-cell__bd" href="/customerPage/customerDetail/'+lists[j]['id']+'">'+
													'<div class="th-info__tit">'+lists[j]['name']+'-'+lists[j]['address']+'</div>'
									//状态显示				
									shtml +=		'<div class="th-info__fbt">'
									
													if(zhant_data == '已领券'){
									shtml +=			'['+lists[j]['status']+']'
														if(lists[j]['overTime'] > 2){
									shtml +=				lists[j]['overTime']+'天后过期'						
														}else{
									shtml +=				'<span class="red">'+lists[j]['overTime']+'天后过期</span>'
														}
													}else if(zhant_data == '已过期'){
									shtml +=			'['+lists[j]['status']+']<span class="gray">超过报备期限未成交</span>'
													}else if(zhant_data == '已成交'){
									shtml +=			'['+lists[j]['status']+']'			
													}else if(zhant_data == '待领券'){
									shtml +=			'['+lists[j]['status']+']'
													}else{
									shtml +=			'['+lists[j]['status']+']'
													}
											
									shtml +=		'</div>'
													
									shtml += 		'<div class="th-info__time">'+lists[j]['addtime']+'</div>'+
												'</a>'
									//二维码标识			
												if(zhant_data == '待领券'){
									shtml += 		'<a class="weui-cell__ft max" style="color:#f52e00" href="/customerPage/getCustomerCode/'+lists[j]['id']+'"><i class="icon-code"></i></a>'
												}else if(zhant_data == '已领券'){
									shtml += 		'<a class="weui-cell__ft max" style="color:#ccc" href="/customerPage/getCustomerCode/'+lists[j]['id']+'"><i class="icon-code"></i></a>'	
												}
									//印章			
												if(zhant_data == '已成交'){
									shtml += 	'<a class="th-info__zhang" href="/customerPage/customerDetail/'+lists[j]['id']+'"><i class="icon-zhang"></i><span class="z">已成交</span></a>'	
												}else if(zhant_data == '已过期'){
									shtml += 	'<a class="th-info__zhang on" href="/customerPage/customerDetail/'+lists[j]['id']+'"><i class="icon-zhang"></i><span class="z">已过期</span></a>'				
												}
									
									shtml += '</div>'
									
						}
						
							shtml += '</div>';

					
					$("#J_list").append(shtml);
					
					};
	
				}else{
					weui.topTips(res.msg);
				}
				
			},
			error: function(e){
	
			},
			complete: function(e){
				$('#J_loadmore').hide();
			}
		});
	
	}
	//-------------------------------------------------------
	//初始化
	$('#J_loadmore').show();
    getCustomerList(1);
	//-------------------------------------------------------
	//月份
	$(window).bind('scroll', function(){ 
		var scrollTop = document.body.scrollTop+document.documentElement.scrollTop;
		$('.J_date_box').each(function() {
        	var $this_t = $(this)
			var hig_t = $this_t.offset().top
			
			if(scrollTop > hig_t+5){
				$('.J_date_box').removeClass('fix')
				$this_t.addClass('fix')
			}else{
				$this_t.removeClass('fix')
			}
        });
	});
	
	
});
</script>
</body>
</html>